/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



import java.io.IOException;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
 *
 * @author Allan Helbling
 */
public class Main {

    public static void main2(String[] args) {
        InterfaceMorseFrameselfIn frameselfIN = new InterfaceMorseFrameselfIn();
        InterfaceMorseFrameselfOut frameselfOUT = new InterfaceMorseFrameselfOut(4000);

        Thread tIN = new Thread(frameselfIN);
        tIN.start();

        Thread tOUT = new Thread(frameselfOUT);
        tOUT.start();

        while (true) {
            System.out.println("Pour fermer le socket \n - IN :1 \n - OUT : 2");
            Scanner sc = new Scanner(System.in);
            String s = sc.nextLine();
            if (s.equals("1")) {
                //InterfaceMorseFrameselfOut.stop();
                try {
                    frameselfIN.socket.getSocket().close();
                    System.out.println("Socket IN fermé : " + frameselfIN.socket.getSocket().isClosed());
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else if (s.equals("2")) {
                try {
                    frameselfOUT.socket.getSocket().close();
                    System.out.println("Socket OUT fermé : " + frameselfOUT.socket.getSocket().isClosed());
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                break;
            }
        }
    }
}
